package java.awt;

public class AwtHelper {

    /**
     * A simplified implementation that returns a component placed in the portion
     * of a container with border layout specified by constraint "key"
     * @param layout container's layout
     * @key one of BorderLayout constraints such as CENTER
     */
    public static Component getChild(BorderLayout layout, String key) {
        Component result = null;

        if (key == BorderLayout.NORTH)
            result = layout.north;
        else if (key == BorderLayout.SOUTH)
            result = layout.south;
        else if (key == BorderLayout.WEST)
            result = layout.west;
        else if (key == BorderLayout.EAST)
            result = layout.east;
        else if (key == BorderLayout.CENTER)
            result = layout.center;
        return result;
    }

}